package com.xnfh.equipment.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.xnfh.common.bean.GuanGaiItem
import com.xnfh.common.bean.WarningItem
import com.xnfh.equipment.R
import com.xnfh.equipment.databinding.ItemSystemLogLayoutBinding
import com.xnfh.framework.utils.TimeUtils

/**
 * @Description:
 * @Author: ziheng
 * @CreateDate: 2023/12/27 15:12
 * @UpdateUser: ziheng
 * @UpdateDate: 2023/12/27 15:12
 * @UpdateRemark: 更新说明
 */
class SystemLogIrrigatteAdapter :
    BaseQuickAdapter<GuanGaiItem, BaseDataBindingHolder<ItemSystemLogLayoutBinding>>(
        R.layout.item_system_log_irrigate_layout
    ) {
    override fun convert(
        holder: BaseDataBindingHolder<ItemSystemLogLayoutBinding>,
        item: GuanGaiItem
    ) {
        holder.setText(R.id.item_irrigate_name, item.Devicename)
        holder.setText(R.id.item_irrigate_stage, TimeUtils.getFriendTimeSecond(item.Totaltime))
        val beginTime = item.Begintime.replace("T", " ").replace("Z", "")
        val endTime = item.Endtime.replace("T", " ").replace("Z", "")
        holder.setText(
            R.id.item_irrigate_time,
            context.getString(R.string.time_mao) + beginTime + " - " + endTime
        )
    }
}